<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { switchNavBarTheme } from '@/utils/common'
import { reactive } from 'vue'
import Coupon from '@/components/Coupon.vue'
import type { CouponVO } from '@/types/reward'
import {getHomePageCouponAPI} from "@/api/reward";

const coupons = reactive<CouponVO[]>([])
onLoad(async () => {
  switchNavBarTheme()
  const res = await getHomePageCouponAPI()
  if (res.code === 200) Object.assign(coupons, res.data)
})
</script>

<template>
  <view style="padding: 20rpx">
    <Coupon v-for="item in coupons" :data="item" useReceive />
  </view>
</template>

<style scoped lang="scss">
</style>
